package sample.positive.service;

import sample.positive.bean.Rectangle;
import sample.positive.bean.Square;
import sample.positive.bean.NotSquareRectangle;

public class ResizeService {

    /**
     * 设置矩形的长和宽
     * @param rectangle
     * @param width
     * @param height
     */
    public void resize(NotSquareRectangle rectangle, double width, double height)
    {
        // 如果是正方形，分别设置长宽会存在问题。让人无法理解。
        rectangle.setWidth(width);
        rectangle.setHeight(height);
    }

    public void resize(Square square, double size)
    {
        square.setSize(size);
    }
}
